package com.run.service.impl;

import com.run.mapper.EbNewsMapper;
import com.run.model.EbNews;
import com.run.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewServiceImpl implements NewsService {
    @Autowired
    private EbNewsMapper ebNewsMapper;

    @Override
    public List<EbNews> list() {
        List<EbNews> ebNews = ebNewsMapper.selectByExample(null);
        return ebNews;
    }

    @Override
    public Integer save(EbNews ebNews) {
        return ebNewsMapper.insert(ebNews);
    }

    @Override
    public EbNews selectOne(Integer enId) {
        return ebNewsMapper.selectByPrimaryKey(enId);
    }

    @Override
    public Integer updateNews(EbNews ebNews) {
        return ebNewsMapper.updateByPrimaryKey(ebNews);
    }

    @Override
    public int deltNews(Integer enId) {
        return ebNewsMapper.deleteByPrimaryKey(enId);
    }
}
